<?php require_once(dirname(__FILE__) . '/../include/config.inc.php');
require_once "function.php";

/*
进度：
0 已经撤单
1 报修成功
2 客服已经联系
3 系统已经派单
4 工程师接单
5 维修完成
6 已经评价
*/
$uid = $_SESSION['uid'];
$userInfo = "";
if (isset($uid)) {

    //有session 从数据库中读取用户名信息
    //$openid_str=$_SESSION['openid'];
    $sql = "SELECT u.*,g.groupname  as groupname FROM `#@__user` as u 
				   left join `#@__usergroup` as g  on u.level=g.id  
				   WHERE u.id='$uid'  ";
    $row = $dosql->GetOne($sql);
    if (is_array($row) && isset($row['id'])) {
        // 返回用户 id
        $id = $row['id'];
        $_SESSION['id'] = $id;
        $userInfo = $row;
        $level = intval($row['level']);
    }
}

if ($level > 5) {
    exit();
}


$orderid = empty($orderid) ? "" : intval($orderid);
if (isset($orderid)) {


    $row = $dosql->GetOne("SELECT * FROM `#@__order`  WHERE id='$orderid'  AND is_delete=0 ");
    if (is_array($row) && isset($row['id'])) {
        $jindu2 = intval($row['jindu']);
        $qiandao = $row['qiandao'];
        $post_id=$row['uid'];


        if (intval($row['jindu']) !== 4) {
            echo "<script>alert('状态错误不能签到！')</script>";
            echo "<script>window.location.href='morderDetail.php?orderid=" . $order_idd . "'  </script>";
            exit();
        }
        $qiandao = $row['qiandao'];
        if ($qiandao == 'true') {
            echo "<script>alert('请不要重复签到！')</script>";
            echo "<script>window.location.href='morderDetail.php?orderid=" . $order_idd . "'  </script>";
            exit();
        }



        // 返回工单数据
        /*
        进度：
        0 已经撤单
        1 报修成功
        2 客服已经联系
        3 系统已经派单
        4 工程师接单
        5 维修完成
        6 已经评价
        */
        $op_str = "";
        //判断是否是该工单的执行人
        $m_str = $row['manageid'];
        $m_arr = explode(",", $m_str);
        if (in_array($uid, $m_arr)) {
            if ($jindu2 == 3) {
                $op_str = '
			<div class="weui-flex__item"><div class="placeholder"><a class="weui-btn weui-btn_primary" id="jiedan_btn"  href="javascript:" onClick="jiedan(' . $row['id'] . ')"><i class="fa fa-thumb-tack" aria-hidden="true"></i>    接单</a></div></div>';

                //撤单
                if($uid==$post_id){
                    $op_str = '
			<div class="weui-flex__item"><div class="placeholder"><a class="weui-btn weui-btn_primary" id="jiedan_btn"  href="javascript:" onClick="jiedan(' . $row['id'] . ')"><i class="fa fa-thumb-tack" aria-hidden="true"></i>    接单</a></div></div>
			<div class="weui-flex__item"><div class="placeholder"><a class="weui-btn weui-btn_warn" id="jiedan_btn"  href="javascript:" onClick="chedan(' . $row['id'] . ')"><i class="fa fa-thumb-tack" aria-hidden="true"></i>    撤单</a></div></div>';
                }

            } elseif ($jindu2 == 4) {

                if ($qiandao == 'true') {
                    $op_str = '
			<div class="weui-flex__item"><div class="placeholder"><a class="weui-btn weui-btn_primary" href="morderDetailover.php?orderid=' . $row['id'] . '" ><i class="fa fa-check
			" aria-hidden="true"></i> 完修</a></div></div>
			
			<div class="weui-flex__item"><div class="placeholder"><a class="weui-btn weui-btn_default" href="morderDetailEdit.php?orderid=' . $row['id'] . '" ><i class="fa fa-pencil" aria-hidden="true"></i>  反馈</a></div></div>
			<div class="weui-flex__item"><div class="placeholder"><a class="weui-btn weui-btn_warn" href="morderDetailZ.php?orderid=' . $row['id'] . '" ><i class="fa fa-random" aria-hidden="true"></i>   转单</a></div></div>';
                } else {
                    $op_str = '
			<div class="weui-flex__item"><div class="placeholder"><a class="weui-btn weui-btn_primary" id="qiandao_btn"  href="javascript:" onClick="qiandao(' . $row['id'] . ')"><i class="fa fa-thumb-tack" aria-hidden="true"></i>    签到</a></div></div>
			
			<div class="weui-flex__item"><div class="placeholder"><a class="weui-btn weui-btn_default" href="morderDetailEdit.php?orderid=' . $row['id'] . '" ><i class="fa fa-pencil" aria-hidden="true"></i>  反馈</a></div></div>
			<div class="weui-flex__item"><div class="placeholder"><a class="weui-btn weui-btn_warn" href="morderDetailZ.php?orderid=' . $row['id'] . '" ><i class="fa fa-random" aria-hidden="true"></i>   转单</a></div></div>';
                }


            }


        }

        //抢单任务
        if ($m_str == "" && ($jindu2 == 1 || $jindu2 == 2)) {
            $op_str = '
			<div class="weui-flex__item"><div class="placeholder"><a class="weui-btn weui-btn_primary" id="jiedan_btn"  href="javascript:" onClick="qiangdan(' . $row['id'] . ')"><i class="fa fa-thumb-tack" aria-hidden="true"></i>    抢单</a></div></div>';
        }


        //故障图片s
        $pic_lists = "";
        $previewImage_url = array();
        if ($row['picfiles'] != "") {
            $picurl_arr = json_decode($row['picfiles'], TRUE);
            for ($i = 0; $i < count($picurl_arr); $i++) {
                $previewImage_url[] = $picurl_arr[$i];
                $pic_lists .= '<li class="weui-uploader__file" style="background-image:url(' . $picurl_arr[$i] . ')"><img src="' . $picurl_arr[$i] . '" width="0"/></li>';
            }
        }

        //完修 图片
        $over_picurls = $row['over_picurls'];
        $over_remark = $row['over_remark'];
        $fee = $row['fee'];

        // 评价
        $pingjia_start = "";
        $pingjia_remark = "";
        $start_str = "";
        if ($jindu2 == 6) {
            $p = $dosql->GetOne("SELECT * FROM `#@__order_evaluate` WHERE orderid='$orderid' ");
            if (is_array($p) && isset($p['id'])) {
                $pingjia_start = $p['start'];
                $pingjia_remark = $p['remark'];
                for ($i = 0; $i < $pingjia_start; $i++) {
                    $start_str .= '<img src="images/x2.png">';
                }
            }
        }

    } else {
        echo "<script>alert('任务不存在或者已经删除！')</script>";
        exit();
    }
}
?>
    <!DOCTYPE html>
    <html>
    <head>
        <title>签到--<?php echo $cfg_webname; ?></title>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="description" content="<?php echo $cfg_webname; ?>">
        <link rel="stylesheet" href="lib/weui.min.css">
        <link rel="stylesheet" href="css/jquery-weui.css">
        <link rel="stylesheet" href="css/font-awesome.min.css">
        <link rel="stylesheet" href="css/demos.css?v=20201211.2224">
    </head>

<body ontouchstart>
<div class="top">
    <div class="user_top">
        <i>
            <?php
            if (intval($level) > 1) {
                echo '<a href="manage.php">' . $userInfo['groupname'] . '</a>';
            } else {
                echo $userInfo['groupname'];
            } ?>
            UID:<?php echo $id; ?>
        </i>
        <div class="user_top_conn"><img src="<?php echo $userInfo['headimgurl'] ?>"/>
            <p><?php echo $userInfo['truename'] ?></p>
            <?php if (intval($level) < 5) { ?><a class="user_link" href="member.php">返回用户</a><?php } ?>
        </div>
    </div>
</div>
<!--工单列表开始-->

<!--工单详情开始-->
<div class="main">
    <div class="weui-cells__title"><i class="fa fa-id-card-o" aria-hidden="true"></i>工单信息</div>
    <div class="weui-form-preview">
        <div class="weui-form-preview__bd">
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">工单号：</label>
                <span class="weui-form-preview__value">
		<?php
        if (!empty($row['poster'])) {
            echo '<i class="fa fa-smile-o blue "></i>';
        }
        if (!empty($row['openid'])) {
            echo '<i class="fa fa-weixin green"></i>';
        }
        ?>
        <?php echo date("Ymd", $row['post_time']) . "-" . $row['id'] ?>
        </span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">单位：</label>
                <span class="weui-form-preview__value"><?php echo $row['school'] ?></span></div>

            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">联系人：</label>
                <span class="weui-form-preview__value"><?php echo $row['truename'] ?></span></div>

            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">电话：</label>
                <span class="weui-form-preview__value"><a href="tel:<?php echo $row['mobile'] ?>"><i class="fa fa-mobile"><?php echo $row['mobile'] ?></a></i></span>
            </div>

            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">地址：</label>
                <span class="weui-form-preview__value" id="daohang" data-orderid="<?php echo $row['id'] ?>"><i class="fa fa-map-marker"><?php echo $row['address'] ?></i></span>
            </div>

            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">服务类型：</label>
                <span class="weui-form-preview__value"><i class="fa  fa-drivers-license-o red"></i> <?php echo getRepairMode($row['apply_device']) ?></span>
            </div>


            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">故障描述：</label>
                <span class="weui-form-preview__value"><?php echo $row['content'] ?></span></div>
           
            <?php if (!empty($row['manageid'])) { ?>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">执行人：</label>
                    <span class="weui-form-preview__value">
			<?php
            if (!empty($row['manageid'])) {
                $m_str = $row['manageid'];
                $m_arr = explode(",", $m_str);
                foreach ($m_arr as $key => $val) {
                    echo ' <i class="fa  fa-user-o red"></i>      ' . getManage($val);
                }
            }
            ?>
        
        </span></div>
            <?php } ?>
            <?php if (!empty($row['begintime'])) { ?>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">任务时间：</label>
                    <span class="weui-form-preview__value"><i class="fa fa-play green"></i> <?php echo date("Y-m-d H:i:s", $row['begintime']) . "  
		<br/><i  class=' red fa  fa-stop'></i>     " . date("Y-m-d H:i:s", $row['endtime']) ?></span></div>
            <?php } ?>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">故障图片</label>
                <div class="weui-uploader">
                    <div class="weui-uploader__bd">
                        <ul class="weui-uploader__files uploaderFiles_item">
                            <?php echo $pic_lists; ?>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="weui-form-preview__item00">
        <div class="weui-cells__title red">任务进度</div>
        <div class="jindulist">
            <ul>
                <?php
                $dosql->Execute("SELECT * FROM `#@__order_log` WHERE orderid='$orderid'  ORDER BY id asc");
                while ($row2 = $dosql->GetArray()) {
                    if ($row2['latitude'] != "") {
                        ?>
                        <li>
                            <a href="openMap.php?orderid=<?php echo $orderid; ?>&logid=<?php echo $row2['id']; ?>"><i class="fa fa-check-circle"><?php echo $row2['op'] ?></i><?php
                                if (!empty($row2['op_manageid'])) {

                                    echo ' <i class="fa  fa-user-o red"></i>      ' . getManage($row2['op_manageid']);

                                }
                                ?> <?php echo date("m-d H:i:s", $row2['op_time']) ?>
                                <i class="red fa fa-map-pin "></i></a></li>
                    <?php } else {
                        ?>
                        <li>
                            <i class="fa fa-check-circle"><?php echo $row2['op'] ?></i>
                            <?php
                            if (!empty($row2['op_manageid'])) {

                                echo ' <i class="fa  fa-user-o red"></i>      ' . getManage($row2['op_manageid']);

                            }
                            ?>

                            <?php echo date("m-d H:i:s", $row2['op_time']) ?>
                        </li>
                        <?php
                    }
                }
                ?>
            </ul>
        </div>
    </div>
    <div class="sub_btn"></div>
    <input type="hidden" name="manageid" id="manageid" value="<?php echo $uid; ?>">
    <input type="hidden" id="latitude" name="latitude">
    <input type="hidden" id="longitude" name="longitude">
    <input type="hidden" id="accuracy" name="accuracy">
    <input type="hidden" id="address" name="address">
    <input type="hidden" id="address_name" name="address_name" value="">
</div>

<!--反馈信息 -->
<?php
$dosql->Execute("SELECT * FROM `#@__order_log` WHERE orderid='$orderid' AND fankui=true  ORDER BY id asc");
while ($row_f = $dosql->GetArray()) {
    ?>
    <div class="main">
        <div class="weui-cells__title"><i class="fa fa-id-card-o" aria-hidden="true"></i>反馈信息</div>
        <div class="weui-form-preview">
            <div class="weui-form-preview__bd">
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label"> 反馈时间：</label>
                    <span class="weui-form-preview__value"><?php echo date("Y-m-d H:i:s", $row_f['op_time']); ?></span>
                </div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label"> 反馈内容：</label>
                    <span class="weui-form-preview__value"><?php echo $row_f['remark']; ?></span></div>
                <?php if (!empty($row_f['picurls'])) { ?>
                    <div class="weui-form-preview__item">
                        <label class="weui-form-preview__label">反馈图片：</label>
                        <div class="weui-uploader">
                            <div class="weui-uploader__bd">
                                <ul class="weui-uploader__files uploaderFiles_item">
                                    <?php
                                    //故障图片
                                    $pic_lists_f = "";
                                    $previewImage_url_f = array();
                                    $picurl_arr_f = json_decode($row_f['picurls'], true);
                                    foreach ($picurl_arr_f as $key => $val) {
                                        echo '<li class="weui-uploader__file" style="background-image:url(' . $val . ')"><img src="' . $val . '" width="0"/></li>';
                                    }
                                    ?>
                                </ul>
                            </div>
                        </div>
                    </div>
                <?php } ?>
            </div>
        </div>
    </div>
    <?php
} ?>


<div class="weui-flex f14"> <?php echo $op_str ?> </div>
<div class="sub_btn"></div>

<!--工单详情结束-->
<?php if ($jindu2 > 4) {
    $pic_lists_over = "";
    $previewImage_url_over = array();
    $picurl_arr_over = json_decode($over_picurls, TRUE);
    for ($i = 0; $i < count($picurl_arr_over); $i++) {
        $pic_lists_over .= '<li class="weui-uploader__file" style="background-image:url(' . $picurl_arr_over[$i] . ')"><img src="' . $picurl_arr_over[$i] . '" width="0"/></li>';
    }
    ?>
    <div class="main">
        <div class="weui-cells__title"><i class="fa fa-id-card-o" aria-hidden="true"></i>任务完成信息</div>
        <div class="weui-form-preview">
            <div class="weui-form-preview__bd">
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label"> 完成概要</label>
                    <span class="weui-form-preview__value"><?php echo $over_remark; ?></span></div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">完成图片</label>
                    <div class="weui-uploader">
                        <div class="weui-uploader__bd">
                            <ul class="weui-uploader__files uploaderFiles_item">
                                <?php echo $pic_lists_over; ?>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php } ?>

<?php
//服务评价
if ($jindu2 == 6) {
    ?>
    <div class="main">
        <div class="weui-cells__title"><i class="fa fa-id-card-o" aria-hidden="true"></i>工单评价</div>
        <div class="weui-form-preview">
            <div class="weui-form-preview__bd">

                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">服务评价：</label>
                    <span class="weui-form-preview__value"><?php echo $start_str ?></span>
                </div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">评价内容：</label>
                    <span class="weui-form-preview__value"><?php echo $pingjia_remark ?></span>
                </div>


            </div>
        </div>
    </div>
<?php } ?>
<div class="clear"></div>
<div class="sub_btn"></div>
<script src="lib/jquery-2.1.4.js"></script>
<script src="lib/fastclick.js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script>
    $(function () {
        FastClick.attach(document.body);
    });
    /*
     * 注意：
     * 1. 所有的JS接口只能在公众号绑定的域名下调用，公众号开发者需要先登录微信公众平台进入“公众号设置”的“功能设置”里填写“JS接口安全域名”。
     * 2. 如果发现在 Android 不能分享自定义内容，请到官网下载最新的包覆盖安装，Android 自定义分享接口需升级至 6.0.2.58 版本及以上。
     * 3. 常见问题及完整 JS-SDK 文档地址：http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html
     *
     * 开发中遇到问题详见文档“附录5-常见错误及解决办法”解决，如仍未能解决可通过以下渠道反馈：
     * 邮箱地址：weixin-open@qq.com
     * 邮件主题：【微信JS-SDK反馈】具体问题
     * 邮件内容说明：用简明的语言描述问题所在，并交代清楚遇到该问题的场景，可附上截屏图片，微信团队会尽快处理你的反馈。
     */
    wx.config({
        debug: false,
        appId: '<?php echo $signPackage["appId"];?>',
        timestamp: <?php echo $signPackage["timestamp"];?>,
        nonceStr: '<?php echo $signPackage["nonceStr"];?>',
        signature: '<?php echo $signPackage["signature"];?>',
        jsApiList: [
            // 所有要调用的 API 都要加到这个列表中
            'onMenuShareTimeline',
            'onMenuShareAppMessage',
            'onMenuShareQQ',
            'onMenuShareWeibo',
            'openAddress',
            'chooseImage',
            'previewImage',
            'uploadImage',
            'downloadImage',
            'openLocation',
            'getLocation'
        ]
    });
    wx.ready(function () {
        //预览图片


        $(".uploaderFiles_item").on("click", function (e) {
            var images = $(this).find("img");
            var imgPaths = [];
            images.each(function () {
                imgPaths.push(this.src);
            });
            console.log(imgPaths);
            current = imgPaths[0];
            wx.previewImage({
                current: current,
                urls: imgPaths
            });
        });


        //打开导航
        $("#daohang").on("click", function () {
            var orderid = $(this).data("orderid");
            $.ajax({
                type: 'POST',
                url: "dingwei.php",
                data: {op: 'dingwei', 'id': orderid},
                dataType: 'JSON',
                success: function (result) {
                    console.log(result);
                    if (result.errno == 0) {
                        console.log(result.msg);
                        if (result.msg === "ok") {
                            wx.openLocation({
                                latitude: result.data.latitude, // 纬度，浮点数，范围为90 ~ -90
                                longitude: result.data.longitude, // 经度，浮点数，范围为180 ~ -180。
                                name: result.data.school, // 位置名
                                address: result.data.address, // 地址详情说明
                                scale: result.data.accuracy, // 地图缩放级别,整形值,范围从1~28。默认为最大

                            });
                        } else {
                            $.alert("获取位置失败，客户没有进行定位", "温馨提示");
                        }
                    }
                }
            });
        })
        //获取gps信息
        wx.getLocation({
            type: 'gcj02', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
            success: function (res) {
                var latitude = res.latitude; // 纬度，浮点数，范围为90 ~ -90
                $("#latitude").val(latitude);
                var longitude = res.longitude; // 经度，浮点数，范围为180 ~ -180。
                $("#longitude").val(longitude);
                var speed = res.speed; // 速度，以米/每秒计
                var accuracy = res.accuracy; // 位置精度
                $("#accuracy").val(accuracy);
                if (latitude != '0.0') {
                    $.ajax({
                        url: "getMap.php?l=" + latitude + "&w=" + longitude,
                        type: "GET",
                        timeout: 2000,
                        dataType: "json",
                        success: function (data) {
                            console.log('ok');
                            var gps_address = data.result.address;
                            var address_name = data.result.formatted_addresses.recommend;
                            //alert(gps_address);
                            $("#address").val(gps_address);
                            $("#address_name").val(address_name);
                        },
                        error: function (data) {
                            console.log('error');

                        }
                    });
                } else {
                    $.alert("请把gps开启为当前地点", " 温馨提示");
                }
            },
            cancel: function (res) {
                $.alert("你拒绝授权获取地理位置，我们的工程师无法快速定位。时效性可能会延时，请谅解", " 温馨提示");
            }

        });


    })


    function jiedan(id) {
        var manageid = $("#manageid").val();
        var latitude = $("#latitude").val();
        var longitude = $("#longitude").val();
        var accuracy = $("#accuracy").val();
        var address = $("#address").val();
        var address_name = $("#address_name").val();
        if (latitude !== "") {
            $.ajax({
                type: 'POST',
                url: "op.php",
                data: {
                    id: id,
                    op: 'jiedan',
                    'manageid': manageid,
                    'latitude': latitude,
                    'longitude': longitude,
                    'accuracy': accuracy,
                    'address': address,
                    'address_name': address_name
                },
                dataType: 'JSON',
                success: function (result) {
                    console.log(result);
                    if (result.errno == 0) {
                        console.log(result.msg);
                        if (result.msg === "ok") {
                            $("#jiedan_btn").hide();
                            $.toast("接单成功", function () {
                                window.location.href = location.href + '?time=' + ((new Date()).getTime());
                            });

                        } else {
                            $.alert("接单失败，下手要快哦", "温馨提示");
                        }
                    }
                }
            });
        } else {
            $.alert("获取不到位置信息", "温馨提示");
        }
    }


    function qiangdan(id) {
        var manageid = $("#manageid").val();
        var latitude = $("#latitude").val();
        var longitude = $("#longitude").val();
        var accuracy = $("#accuracy").val();
        var address = $("#address").val();
        var address_name = $("#address_name").val();
        if (latitude !== "") {
            $.ajax({
                type: 'POST',
                url: "op.php",
                data: {
                    id: id,
                    op: 'qiangdan',
                    'manageid': manageid,
                    'latitude': latitude,
                    'longitude': longitude,
                    'accuracy': accuracy,
                    'address': address,
                    'address_name': address_name
                },
                dataType: 'JSON',
                success: function (result) {
                    console.log(result);
                    if (result.errno == 0) {
                        console.log(result.msg);
                        if (result.msg === "ok") {
                            $("#jiedan_btn").hide();
                            $.toast("接单成功", function () {
                                window.location.href = location.href + '?time=' + ((new Date()).getTime());
                            });

                        } else {
                            $.alert("接单失败，下手要快哦", "温馨提示");
                        }
                    }
                }
            });
        } else {
            $.alert("获取不到位置信息", "温馨提示");
        }
    }



    function chedan(id) {
        $.ajax({
            type: 'POST',
            url: "op.php",
            data: {id: id, op: 'chedan'},
            dataType: 'JSON',
            success: function (result) {
                console.log(result);
                if (result.errno == 0) {
                    console.log(result.msg);
                    if (result.msg === "ok") {
                        $.toast("取消工单成功", function () {
                            window.location.reload();
                        });

                    } else {
                        $.alert("小主，你的工单已经在处理中...<br/> 不能取消工单哦！", "温馨提示");
                    }
                }
            }
        });

    }

    // 签到
    function qiandao(id) {
        var manageid = $("#manageid").val();
        var latitude = $("#latitude").val();
        var longitude = $("#longitude").val();
        var accuracy = $("#accuracy").val();
        var address = $("#address").val();
        var address_name = $("#address_name").val();
        if (latitude !== "") {
            $.ajax({
                type: 'POST',
                url: "op.php",
                data: {
                    id: id,
                    op: 'qiandao',
                    'manageid': manageid,
                    'latitude': latitude,
                    'longitude': longitude,
                    'accuracy': accuracy,
                    'address': address,
                    'address_name': address_name
                },
                dataType: 'JSON',
                success: function (result) {
                    console.log(result);
                    if (result.errno == 0) {
                        console.log(result.msg);
                        if (result.msg === "ok") {
                            $("#qiandao_btn").hide();
                            $.toast("签到成功", function () {
                                window.location.href = location.href + '?time=' + ((new Date()).getTime());
                            });

                        } else {
                            $.alert("签到错误", "温馨提示");
                        }
                    }
                }
            });
        } else {
            $.alert("获取不到位置信息", "温馨提示");
        }
    }


</script>
<script src="js/jquery-weui.js"></script>
<?php require_once('footer.php'); ?>